package main

import (
	"ywebgo/biz"
	"ywebgo/filter"
	"ywebgo/server"
)

func main() {

	webServer := server.NewServer()
	webServer.AddFilter(filter.MetricFilterBuilder)

	webServer.Enroll("GET", "/users", biz.QueryUsers)
	webServer.Enroll("GET", "/users/:id", biz.QueryUserById)
	webServer.Enroll("POST", "/users", biz.CreateUser)
	webServer.Enroll("DELETE", "/users", biz.DeleteUser)
	webServer.Enroll("PUT", "/users", biz.UpdateUser)

	webServer.Start(":8080")

	//http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
	//	fmt.Fprintf(w, "Welcome to my website!")
	//})
	//
	//fs := http.FileServer(http.Dir("static/"))
	//http.Handle("/static/", http.StripPrefix("/static/", fs))
	//
	//http.ListenAndServe(":8080", nil)
}
